/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.webcrm.model;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author Frederiko
 */
@Entity
@Table(name = "status_evento")
@SequenceGenerator(name = "status_evento_idstatus_evento_seq", sequenceName = "status_evento_idstatus_evento_seq", allocationSize = 1)
@NamedQueries({
    @NamedQuery(name = "StatusEvento.findAll", query = "SELECT s FROM StatusEvento s"),
    @NamedQuery(name = "StatusEvento.findByIdStatusEvento", query = "SELECT s FROM StatusEvento s WHERE s.idStatusEvento = :idStatusEvento"),
    @NamedQuery(name = "StatusEvento.findByNomeStatus", query = "SELECT s FROM StatusEvento s WHERE s.nomeStatus = :nomeStatus")})
public class StatusEvento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "status_evento_idstatus_evento_seq")
    @Column(name = "idstatus_evento", nullable = false)
    private Integer idStatusEvento;
    @Basic(optional = false)
    @Column(name = "nome_status", nullable = false, length = 50)
    private String nomeStatus;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "statusEvento", fetch = FetchType.LAZY)
    private List<Evento> eventosList;

    public StatusEvento() {
    }

    public StatusEvento(Integer idStatusEvento) {
        this.idStatusEvento = idStatusEvento;
    }

    public StatusEvento(Integer idStatusEvento, String nomeStatus) {
        this.idStatusEvento = idStatusEvento;
        this.nomeStatus = nomeStatus;
    }

    public Integer getIdStatusEvento() {
        return idStatusEvento;
    }

    public void setIdStatusEvento(Integer idStatusEvento) {
        this.idStatusEvento = idStatusEvento;
    }

    public String getNomeStatus() {
        return nomeStatus;
    }

    public void setNomeStatus(String nomeStatus) {
        this.nomeStatus = nomeStatus;
    }

    public List<Evento> getEventosList() {
        return eventosList;
    }

    public void setEventosList(List<Evento> eventosList) {
        this.eventosList = eventosList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idStatusEvento != null ? idStatusEvento.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof StatusEvento)) {
            return false;
        }
        StatusEvento other = (StatusEvento) object;
        if ((this.idStatusEvento == null && other.idStatusEvento != null) || (this.idStatusEvento != null && !this.idStatusEvento.equals(other.idStatusEvento))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.com.attende.model.StatusEvento[idstatusEvento=" + idStatusEvento + "]";
    }

}
